const SLIDER_SCROLL_STEP = 0.05; /* Slider scrolling step in % */
+const Ornament = {
+ NONE: 0,
+ DOT: 1,
+};
+
function _ensureStyle(actor) {
if (actor.get_children) {
let children = actor.get_children();
this.actor._delegate = this;
this._children = [];
+ this._ornament = Ornament.NONE;
this._dot = null;
this._columnWidths = null;
this._spacing = 0;
this._removeChild(child);
},
- setShowDot: function(show) {
- if (show) {
- if (this._dot)
- return;
+ setOrnament: function(ornament) {
+ if (ornament == this._ornament)
+ return;
+
+ this._ornament = ornament;
+ if (ornament == Ornament.DOT) {
this._dot = new St.DrawingArea({ style_class: 'popup-menu-item-dot' });
this._dot.connect('repaint', Lang.bind(this, this._onRepaintDot));
this.actor.add_actor(this._dot);
this.actor.add_accessible_state (Atk.StateType.CHECKED);
- } else {
- if (!this._dot)
- return;
-
+ } else if (ornament == Ornament.NONE) {
this._dot.destroy();
this._dot = null;
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
item = new PopupMenuItem(label);
item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack();
action.items.push(item);
- item.setShowDot(action.state.deep_unpack() == item._remoteTarget);
+ item.setOrnament(action.state.deep_unpack() == item._remoteTarget ?
+ Ornament.DOT : Ornament.NONE);
specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
this.actionGroup.activate_action(action_id, GLib.Variant.new_string(item._remoteTarget));
}));
break;
case 's':
for (let i = 0; i < action.items.length; i++)
- action.items[i].setShowDot(action.items[i]._remoteTarget == action.state.deep_unpack());
+ action.items[i].setOrnament(action.items[i]._remoteTarget == action.state.deep_unpack() ?
+ Ornament.DOT : Ornament.NONE);
}
}
},
[oldSource, this._currentSource] = [this._currentSource, newSource];
if (oldSource) {
- oldSource.menuItem.setShowDot(false);
+ oldSource.menuItem.setOrnament(PopupMenu.Ornament.NONE);
oldSource.indicatorLabel.hide();
}
this.actor.show();
- newSource.menuItem.setShowDot(true);
+ newSource.menuItem.setOrnament(PopupMenu.Ornament.DOT);
newSource.indicatorLabel.show();
this._buildPropSection(newSource.properties);
item.prop = prop;
radioGroup.push(item);
item.radioGroup = radioGroup;
- item.setShowDot(prop.get_state() == IBus.PropState.CHECKED);
+ item.setOrnament(prop.get_state() == IBus.PropState.CHECKED ?
+ PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
item.connect('activate', Lang.bind(this, function() {
if (item.prop.get_state() == IBus.PropState.CHECKED)
return;
let group = item.radioGroup;
for (let i = 0; i < group.length; ++i) {
if (group[i] == item) {
- item.setShowDot(true);
+ item.setOrnament(PopupMenu.Ornament.DOT);
item.prop.set_state(IBus.PropState.CHECKED);
this._ibusManager.activateProperty(item.prop.get_key(),
IBus.PropState.CHECKED);
} else {
- group[i].setShowDot(false);
+ group[i].setOrnament(PopupMenu.Ornament.NONE);
group[i].prop.set_state(IBus.PropState.UNCHECKED);
this._ibusManager.activateProperty(group[i].prop.get_key(),
IBus.PropState.UNCHECKED);
title = _("Connected (private)");
}
this._activeConnectionItem = new PopupMenu.PopupMenuItem(title, { reactive: false });
- this._activeConnectionItem.setShowDot(true);
+ this._activeConnectionItem.setOrnament(PopupMenu.Ornament.DOT);
},
_deviceStateChanged: function(device, newstate, oldstate, reason) {
this._activeConnectionItem = new PopupMenu.PopupImageMenuItem(title,
'network-wireless-connected-symbolic',
{ reactive: false });
- this._activeConnectionItem.setShowDot(true);
+ this._activeConnectionItem.setOrnament(PopupMenu.Ornament.DOT);
},
_createAutomaticConnection: function(apObj) {